<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=no,maximum-scale=1.0,minimum-scale=1.0" />
<meta content="telephone=no" name="format-detection" />
<link href="<{$res_url}>/css/wap/public.css" rel="stylesheet" type="text/css">
<link href="<{$res_url}>/css/wap/home.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<{$res_url}>/js/wap/jquery.min.js"></script>
<script src="<{$res_url}>/js/wap/jquery.toggle-password.min.js"></script>
<script>
	$(function(){
		$('#password').togglePassword({
			el:'#togglePassword',
		});
        $('#btn1').bind('click',function(){
            var url = '<{$url}>';
            var data = {'uname':$('#uname').val(),'password':$('#password').val()};
            $.post(url,data,function(msg){
                if(msg.rsp == 'fail'){
                    alert(msg.data.msg);
                }else if(msg.data.member_id){
                    window.location.href = '<{$urls}>';
                }
            },'json');
        });
        $('#btn2').bind('click',function(){
            window.location.href = '<{$rurl}>';
        });
	});

</script>
</head>

<body>
	
    <section class="warp">
    	<div class="content">
            <!--<header>
                <div class="search fl"><a href="javascript:history.back()"><img src="<{$res_url}>/images/wap/icon1.png" width="20"></a></div>
                <div class="logo"><{$logo}></div>
            </header>-->
            
            <section class="loading">
            	<div class="loading_logo"><img src="<{$res_url}>/images/wap/logo.png"></div>
                    <ul>
                        <li><span><img src="<{$res_url}>/images/wap/icon2.png"></span><input class="text a-account" name="uname" id="uname" type="text" placeholder="请输入手机号码"></li>
                        <li><span><img src="<{$res_url}>/images/wap/icon3.png"></span><input name="password" id="password" type="password" placeholder="密码"><i id="togglePassword"></i></li>
                        <li><p><a href="<{link app=b2c ctl=wap_personal act=resetpage}>">忘记密码？</a></p></li>
                        <li><button id="btn1">登录</button><button id="btn2">注册</button></li>
                    </ul>
            </section>
            <!--<section class="others_load">
            	<h2><span>社交账号登录：</span></h2>
                <ul class="clearfix">
                	<li><a href="#" title="" id="weixin"></a></li>
                    <li><a href="#" id="sina"></a></li>
                    <li><a href="<{link app=b2c ctl=wap_personal act=resetpage}>" id="qq"></a></li>
                </ul>
            </section>-->
        </div>
    </section>
    
</body>
<script>
    $('.form .a-account').change(function(e) {
        if(/^1[34578]\d{9}$/.test(this.value)) {
            $.post('<{link app=b2c ctl=wap_passport act=login_ajax_account}>', this.name + '=' + this.value, function(rs){
                if(rs) {
                    try{
                        rs = $.parseJSON(rs);
                    } catch (e) {}
                    if(rs.error) {
                        if(typeof rs.error === 'string') alert(rs.error);
                    }
                    else if(rs.needVerify === 'true') {
                        $('.form .a-need-verify').show();
                    }
                }
            });
            // alert('您的手机号码还未通过验证，点击进行验证');
        }
        else {
            $('.form .a-need-verify').hide();
        }
    });

    $('.form .btn-send').click(function (e) {
        e.preventDefault();
        var el = $('.form .a-account');
        if($(this).hasClass('disabled')) return false;
        sendVerify(this, el.attr('name') + '=' + el.val() + '&type=activation');
    });

    function sendVerify(el, data) {
        var url = el.href;
        $(el).addClass('disabled');
        var cd = new countdown(el, {
            start: 120,
            secondOnly: true,
            callback: function(e) {
                $(el).removeClass('disabled').html('重发密码');
            }
        });
        $.post(url, data, function(rs) {
            if(rs) {
                try{
                    rs = $.parseJSON(rs);
                } catch (e) {}
                if(rs.error) {
                    $(el).removeClass('disabled').html('重发密码');
                    clearTimeout(cd.timer);
                    if(typeof rs.error === 'string') alert(rs.error);
                }
            }
        });
    }
</script>
</html>
